/*
 *  PZKeyCodes.h
 *  Pezzer
 *
 *  Created by Spence DiNicolantonio on 8/29/09.
 *  Copyright 2009 Necrosoft. All rights reserved.
 *
 */

static const NSUInteger PZKeyCodeCount = 127;

// Mac key codes
typedef enum _PZKeyCode {
	// Numbers
	PZKeyCode0 = 29,
	PZKeyCode1 = 18,
	PZKeyCode2 = 19,
	PZKeyCode3 = 20,
	PZKeyCode4 = 21,
	PZKeyCode5 = 23,
	PZKeyCode6 = 22,
	PZKeyCode7 = 26,
	PZKeyCode8 = 28,
	PZKeyCode9 = 25,
	
	// Letters
	PZKeyCodeA = 0,
	PZKeyCodeB = 11,
	PZKeyCodeC = 8,
	PZKeyCodeD = 2,
	PZKeyCodeE = 14,
	PZKeyCodeF = 3,
	PZKeyCodeG = 5,
	PZKeyCodeH = 4,
	PZKeyCodeI = 34,
	PZKeyCodeJ = 38,
	PZKeyCodeK = 40,
	PZKeyCodeL = 37,
	PZKeyCodeM = 46,
	PZKeyCodeN = 45,
	PZKeyCodeO = 31,
	PZKeyCodeP = 35,
	PZKeyCodeQ = 12,
	PZKeyCodeR = 15,
	PZKeyCodeS = 1,
	PZKeyCodeT = 17,
	PZKeyCodeU = 32,
	PZKeyCodeV = 9,
	PZKeyCodeW = 13,
	PZKeyCodeX = 7,
	PZKeyCodeY = 16,
	PZKeyCodeZ = 6,
		
	// Marks/Symbols
	PZKeyCodeBacktick = 50,
	PZKeyCodeDash = 27,
	PZKeyCodeComma = 43,
	PZKeyCodeSemicolon = 41,
	PZKeyCodePeriod = 47,
	PZKeyCodeSingleQuote = 39,
	PZKeyCodeOpenBracket = 33,
	PZKeyCodeCloseBracket = 30,
	PZKeyCodeBackslash = 44,
	PZKeyCodeForwardSlash = 42,
	PZKeyCodeEquals = 24,
	PZKeyCodeDollar = 10,

	// Function Keys
	PZKeyCodeF1 = 122,
	PZKeyCodeF10 = 109,
	PZKeyCodeF11 = 103,
	PZKeyCodeF12 = 111,
	PZKeyCodeF13 = 105,
	PZKeyCodeF14 = 107,
	PZKeyCodeF15 = 113,
	PZKeyCodeF2 = 120,
	PZKeyCodeF3 = 99,
	PZKeyCodeF4 = 118,
	PZKeyCodeF5 = 96,
	PZKeyCodeF6 = 97,
	PZKeyCodeF7 = 98,
	PZKeyCodeF8 = 100,
	PZKeyCodeF9 = 101,

	// NumPad
	PZKeyCodeNumPadDash = 78,
	PZKeyCodeNumPadPeriod = 65,
	PZKeyCodeNumPadAsterisk = 67,
	PZKeyCodeNumPadBackslash = 75,
	PZKeyCodeNumPadPlus = 69,
	PZKeyCodeNumPadEquals = 81,
	PZKeyCodeNumPad0 = 82,
	PZKeyCodeNumPad1 = 83,
	PZKeyCodeNumPad2 = 84,
	PZKeyCodeNumPad3 = 85,
	PZKeyCodeNumPad4 = 86,
	PZKeyCodeNumPad5 = 87,
	PZKeyCodeNumPad6 = 88,
	PZKeyCodeNumPad7 = 89,
	PZKeyCodeNumPad8 = 91,
	PZKeyCodeNumPad9 = 92,

	// Return & Enter
	PZKeyCodeReturn = 36,
	PZKeyCodeNumPadEnter = 76,

	// Home, End & Insert 
	PZKeyCodeHome = 115,
	PZKeyCodeEnd = 119,
	PZKeyCodeIns = 114,

	// PageUp & PageDown
	PZKeyCodePageUp = 116,
	PZKeyCodePageDown = 121,

	// Delete
	PZKeyCodeDel = 117,
	PZKeyCodeDelete = 51,

	// Arrow Keys
	PZKeyCodeRightArrow = 124,
	PZKeyCodeLeftArrow = 123,
	PZKeyCodeUpArrow = 126,
	PZKeyCodeDownArrow = 125,

	// Modifiers, etc.
	PZKeyCodeEscape = 53,
	PZKeyCodeCapsLock = 57,
	PZKeyCodeClear = 71,
	PZKeyCodeCommand = 55,
	PZKeyCodeOption = 58,
	PZKeyCodeControl = 59,
	PZKeyCodeShift = 56,
	PZKeyCodeSpace = 49,
	PZKeyCodeTab = 48,
} PZKeyCode;

// String names of all Mac key codes.
static NSString *PZKeyCodeNames[] = {
@"A",
@"S",
@"D",
@"F",
@"H",
@"G",
@"Z",
@"X",
@"C",
@"V",
@"Dollar",
@"B",
@"Q",
@"W",
@"E",
@"R",
@"Y",
@"T",
@"1",
@"2",
@"3",
@"4",
@"6",
@"5",
@"Equals",
@"9",
@"7",
@"Dash",
@"8",
@"0",
@"Close Bracket",
@"O",
@"U",
@"Open Bracket",
@"I",
@"P",
@"Return",
@"L",
@"J",
@"Single Quote",
@"K",
@"Semicolon",
@"Backslash",
@"Comma",
@"V",
@"N",
@"M",
@"Period",
@"Tab",
@"Space",
@"Backtick",
@"Delete",
@"", // Unused
@"Escape",
@"", // Unused
@"Command",
@"Shift",
@"Caps Lock",
@"Option",
@"Control",
@"", // Unused
@"", // Unused
@"", // Unused
@"", // Unused
@"", // Unused
@"NumPad Period",
@"", // Unused
@"NumPad Asterisk",
@"", // Unused
@"NumPad Plus",
@"", // Unused
@"Clear",
@"", // Unused
@"", // Unused
@"", // Unused
@"NumPad Backslash",
@"NumPad Enter",
@"", // Unused
@"NumPad Dash",
@"", // Unused
@"", // Unused
@"NumPad Equals",
@"NumPad 0",
@"NumPad 1",
@"NumPad 2",
@"NumPad 3",
@"NumPad 4",
@"NumPad 5",
@"NumPad 6",
@"NumPad 7",
@"", // Unused
@"NumPad 8",
@"NumPad 9",
@"", // Unused
@"", // Unused
@"", // Unused
@"F5",
@"F6",
@"F7",
@"F3",
@"F8",
@"F9",
@"", // Unused
@"F11",
@"", // Unused
@"F13",
@"", // Unused
@"F14",
@"", // Unused
@"F10",
@"", // Unused
@"F12",
@"", // Unused
@"F15",
@"Insert",
@"Home",
@"PageUp",
@"Delete",
@"F4",
@"End",
@"F2",
@"PageDown",
@"F1",
@"Left Arrow",
@"Right Arrow",
@"Down Arrow",
@"Up Arrow",
};

/**
 * Returns the string name of a given key code.
 */
static inline NSString* PZKeyCodeName(PZKeyCode keyCode) {
	return PZKeyCodeNames[keyCode];
}